/*
 * @lc app=leetcode.cn id=303 lang=typescript
 *
 * [303] 区域和检索 - 数组不可变
 */

// @lc code=start
class NumArray {
    constructor(private nums: number[]) {}

    sumRange(left: number, right: number): number {
        let sum = 0;
        for (let index = left; index <= right; index++) {
            sum += this.nums[index];
        }
        return sum;
    }
}

/**
 * Your NumArray object will be instantiated and called as such:
 * var obj = new NumArray(nums)
 * var param_1 = obj.sumRange(left,right)
 */
// @lc code=end
